<template>
  <view class="demo-container">
    <!-- 基础用法 -->
    <view class="demo-block">
      <view class="demo-block__title">基础用法</view>
      <view class="demo-block__content">
        <fu-button 
          type="primary"
          @click="show1 = true"
        >显示遮罩层</fu-button>
        <fu-overlay 
          v-model:show="show1"
          @click="show1 = false"
        />
      </view>
    </view>
    
    <!-- 嵌入内容 -->
    <view class="demo-block">
      <view class="demo-block__title">嵌入内容</view>
      <view class="demo-block__content">
        <fu-button 
          type="primary"
          @click="show2 = true"
        >显示带内容的遮罩层</fu-button>
        <fu-overlay 
          v-model:show="show2"
          @click="show2 = false"
        >
          <view class="overlay-content">
            <text>自定义内容</text>
          </view>
        </fu-overlay>
      </view>
    </view>
    
    <!-- 自定义背景色 -->
    <view class="demo-block">
      <view class="demo-block__title">自定义背景色</view>
      <view class="demo-block__content">
        <fu-button 
          type="primary"
          @click="show3 = true"
        >显示自定义背景色</fu-button>
        <fu-overlay 
          v-model:show="show3"
          custom-color="rgba(0, 0, 255, 0.3)"
          @click="show3 = false"
        />
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      show1: false,
      show2: false,
      show3: false
    }
  }
}
</script>

<style lang="scss" scoped>
.demo-container {
  padding: 20rpx;
}

.demo-block {
  margin-bottom: 30rpx;
  
  &__title {
    margin-bottom: 20rpx;
    font-size: var(--fu-font-size-lg);
    color: var(--fu-text-color);
  }
  
  &__content {
    background-color: #fff;
    border-radius: var(--fu-radius-base);
    padding: 30rpx;
  }
}

.overlay-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 40rpx;
  background-color: #fff;
  border-radius: var(--fu-radius-base);
  text-align: center;
  
  text {
    font-size: 32rpx;
    color: var(--fu-text-color);
  }
}
</style> 